﻿// See https://aka.ms/new-console-template for more information

using P9_WeatherAPI;

Console.WriteLine("请输入城市名称:");
string city = Console.ReadLine();

WeatherService weatherService = new WeatherService();
WeatherData weatherData = await weatherService.GetWeatherAsync(city);

if (weatherData != null)
{
    Console.WriteLine($"\n{city} 的天气信息:");
    Console.WriteLine($"温度: {weatherData.main.temp}°C");
    Console.WriteLine($"天气: {weatherData.weather[0].description}");
    Console.WriteLine($"湿度: {weatherData.main.humidity}%");
}
else
{
    Console.WriteLine("无法获取天气信息。请检查城市名称或 API 是否可用。");
}

Console.ReadKey();